﻿Public MustInherit Class ItemPage
    Inherits BasePage

    Protected Overridable ReadOnly Property InsertionPermitted() As Boolean
        Get
            Return Roles.IsUserInRole("Manager") Or Roles.IsUserInRole("Member")
        End Get
    End Property

    Protected Overridable ReadOnly Property TaggingPermitted() As Boolean
        Get
            Return Roles.IsUserInRole("Manager") Or Roles.IsUserInRole("Member")
        End Get
    End Property

    Protected Function GetCurrentUserID() As ULong
        Return GetUserID(User.Identity.Name)
    End Function

    Protected Function GetUserID(ByVal userName As String) As ULong
        Dim gateway As New SiteUserGateway()
        Return gateway.FindByUserName(userName).Rows(0)("ID")
    End Function

    Protected Function GetPhotoNormalPath(ByVal fileName As String) As String
        Return PhotoUtils.getNormalPath(fileName)
    End Function

    Protected Function GetPhotoThumbPath(ByVal fileName As String) As String
        Return PhotoUtils.getThumbPath(fileName)
    End Function
End Class
